/*
 * FontColor.java
 *
 *
 * Copyright (c) 2007 Aptech Software Limited. All Rights Reserved.
 */

package demo.controls;

import java.awt.Color;

/**
 *
 * @author  Vincent
 */
public class FontColor extends javax.swing.JDialog {

    /** Creates new form ChooseColor */
    public FontColor(java.awt.Frame parent, boolean modal) {
        super(parent, modal);

        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
        ccrFontChooser = new javax.swing.JColorChooser();
        btnOK = new javax.swing.JButton();
        btnCancel = new javax.swing.JButton();

        getContentPane().setLayout(new java.awt.FlowLayout());

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Font Color");
        getContentPane().add(ccrFontChooser);

        btnOK.setFont(new java.awt.Font("Tahoma", 0, 11));
        btnOK.setText("OK");
        btnOK.setPreferredSize(new java.awt.Dimension(100, 23));
        btnOK.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnOKActionPerformed(evt);
            }
        });

        getContentPane().add(btnOK);

        btnCancel.setFont(new java.awt.Font("Tahoma", 0, 11));
        btnCancel.setText("Cancel");
        btnCancel.setPreferredSize(new java.awt.Dimension(100, 23));
        btnCancel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCancelActionPerformed(evt);
            }
        });

        getContentPane().add(btnCancel);

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-440)/2, (screenSize.height-410)/2, 440, 410);
    }// </editor-fold>//GEN-END:initComponents

    private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelActionPerformed
// TODO add your handling code here:
        System.exit(0);
    }//GEN-LAST:event_btnCancelActionPerformed

    private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOKActionPerformed
// TODO add your handling code here:
        color = ccrFontChooser.getColor();
        dispose();
    }//GEN-LAST:event_btnOKActionPerformed
    public Color getColor() {
        return color;
    }
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new FontColor(new javax.swing.JFrame(), true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnCancel;
    private javax.swing.JButton btnOK;
    private javax.swing.JColorChooser ccrFontChooser;
    // End of variables declaration//GEN-END:variables
    Color color;
}
